{% extends "contest/base.html" %}
{% load friendly_time %}
{% load full_time %}
{% block contest_page_title%}题目列表 -{% endblock %}
{% block contest_page_body %}
    {% include "problem/status/filter.html" %}
    {{ pager }}
    {% include "problem/status/list_body.html" %}
    {{ pager }}
{% endblock %}
{% block contest_page_script %}
<script type="text/javascript">
    $(function () {
        $(".filter-flag").click(function(){
            $(".filter-flag").removeClass("label-primary").removeClass('label-transparent');
            $(this).addClass("label-primary");
            $(".filter-flag").not(".label-primary").addClass('label-transparent');
            $("#ipt-filter-flag").val($(this).attr("dat-val"));
        });
        $("#status_filter_bar").click(function(){
            $("#status_filter").slideToggle();
        });
        $(".btn_contest_change_status").click(function () {
            var id = $(this).attr("data-id");
            $.ModalBox({
                title: '修改评测结果',
                mode: "url",
                url: "{% url 'contest_mgr_change_status' contest.id 0 %}".replace("status/0", "status/" + id),
                loaded: function () {
                    $("#change_status_form").submit(function () {
                        $.GRestP({
                            responseType: 'json',
                            callback: function (flag, entity) {
                                if (flag) {
                                    $.AlertBox({
                                        body: "评测状态保存成功",
                                        color: "success",
                                        title: "操作成功",
                                        callback: function () {
                                            $.ModalBox({}).hide();
                                            window.location.reload();
                                        }
                                    }).show();
                                } else {
                                    $.AlertBox({body: entity.msg, color: "danger", title: "操作失败"}).show();
                                }
                            }
                        }).submit_form(this);
                        return false;
                    });
                },
                default_btn_action: function () {
                    $("#change_status_form").submit();
                }
            }).show();
        });
    });
</script>
{% endblock %}